Option Strict Off
Option Explicit On
Friend Class frmDeleteCategory
	Inherits System.Windows.Forms.Form
#Region "Windows Form Designer generated code "
	Public Sub New()
		MyBase.New()
		If m_vb6FormDefInstance Is Nothing Then
			If m_InitializingDefInstance Then
				m_vb6FormDefInstance = Me
			Else
				Try 
					'For the start-up form, the first instance created is the default instance.
					If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
						m_vb6FormDefInstance = Me
					End If
				Catch
				End Try
			End If
		End If
		'This call is required by the Windows Form Designer.
		InitializeComponent()
	End Sub
	'Form overrides dispose to clean up the component list.
	Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
		If Disposing Then
			If Not components Is Nothing Then
				components.Dispose()
			End If
		End If
		MyBase.Dispose(Disposing)
	End Sub
	'Required by the Windows Form Designer
	Private components As System.ComponentModel.IContainer
	Public ToolTip1 As System.Windows.Forms.ToolTip
	Public WithEvents _cmdButton_0 As System.Windows.Forms.Button
	Public WithEvents _cmdButton_1 As System.Windows.Forms.Button
	Public WithEvents lstCategory As System.Windows.Forms.ListBox
	Public WithEvents cmdButton As Microsoft.VisualBasic.Compatibility.VB6.ButtonArray
	'NOTE: The following procedure is required by the Windows Form Designer
	'It can be modified using the Windows Form Designer.
	'Do not modify it using the code editor.
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
		Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmDeleteCategory))
		Me.components = New System.ComponentModel.Container()
		Me.ToolTip1 = New System.Windows.Forms.ToolTip(components)
		Me.ToolTip1.Active = True
		Me._cmdButton_0 = New System.Windows.Forms.Button
		Me._cmdButton_1 = New System.Windows.Forms.Button
		Me.lstCategory = New System.Windows.Forms.ListBox
		Me.cmdButton = New Microsoft.VisualBasic.Compatibility.VB6.ButtonArray(components)
		CType(Me.cmdButton, System.ComponentModel.ISupportInitialize).BeginInit()
		Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow
		Me.Text = "Delete Categories"
		Me.ClientSize = New System.Drawing.Size(192, 161)
		Me.Location = New System.Drawing.Point(4, 22)
		Me.MaximizeBox = False
		Me.MinimizeBox = False
		Me.ShowInTaskbar = False
		Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
		Me.Font = New System.Drawing.Font("Arial", 8!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
		Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
		Me.BackColor = System.Drawing.SystemColors.Control
		Me.ControlBox = True
		Me.Enabled = True
		Me.KeyPreview = False
		Me.Cursor = System.Windows.Forms.Cursors.Default
		Me.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.HelpButton = False
		Me.WindowState = System.Windows.Forms.FormWindowState.Normal
		Me.Name = "frmDeleteCategory"
		Me._cmdButton_0.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
		Me._cmdButton_0.Text = "Remove"
		Me._cmdButton_0.Size = New System.Drawing.Size(65, 25)
		Me._cmdButton_0.Location = New System.Drawing.Point(40, 120)
		Me._cmdButton_0.TabIndex = 2
		Me._cmdButton_0.Font = New System.Drawing.Font("Arial", 8!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
		Me._cmdButton_0.BackColor = System.Drawing.SystemColors.Control
		Me._cmdButton_0.CausesValidation = True
		Me._cmdButton_0.Enabled = True
		Me._cmdButton_0.ForeColor = System.Drawing.SystemColors.ControlText
		Me._cmdButton_0.Cursor = System.Windows.Forms.Cursors.Default
		Me._cmdButton_0.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me._cmdButton_0.TabStop = True
		Me._cmdButton_0.Name = "_cmdButton_0"
		Me._cmdButton_1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
		Me._cmdButton_1.Text = "Cancel"
		Me._cmdButton_1.Size = New System.Drawing.Size(65, 25)
		Me._cmdButton_1.Location = New System.Drawing.Point(112, 120)
		Me._cmdButton_1.TabIndex = 1
		Me._cmdButton_1.Font = New System.Drawing.Font("Arial", 8!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
		Me._cmdButton_1.BackColor = System.Drawing.SystemColors.Control
		Me._cmdButton_1.CausesValidation = True
		Me._cmdButton_1.Enabled = True
		Me._cmdButton_1.ForeColor = System.Drawing.SystemColors.ControlText
		Me._cmdButton_1.Cursor = System.Windows.Forms.Cursors.Default
		Me._cmdButton_1.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me._cmdButton_1.TabStop = True
		Me._cmdButton_1.Name = "_cmdButton_1"
		Me.lstCategory.Size = New System.Drawing.Size(153, 85)
		Me.lstCategory.Location = New System.Drawing.Point(8, 8)
		Me.lstCategory.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
		Me.lstCategory.TabIndex = 0
		Me.lstCategory.Font = New System.Drawing.Font("Arial", 8!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
		Me.lstCategory.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
		Me.lstCategory.BackColor = System.Drawing.SystemColors.Window
		Me.lstCategory.CausesValidation = True
		Me.lstCategory.Enabled = True
		Me.lstCategory.ForeColor = System.Drawing.SystemColors.WindowText
		Me.lstCategory.IntegralHeight = True
		Me.lstCategory.Cursor = System.Windows.Forms.Cursors.Default
		Me.lstCategory.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.lstCategory.Sorted = False
		Me.lstCategory.TabStop = True
		Me.lstCategory.Visible = True
		Me.lstCategory.MultiColumn = False
		Me.lstCategory.Name = "lstCategory"
		Me.Controls.Add(_cmdButton_0)
		Me.Controls.Add(_cmdButton_1)
		Me.Controls.Add(lstCategory)
		Me.cmdButton.SetIndex(_cmdButton_0, CType(0, Short))
		Me.cmdButton.SetIndex(_cmdButton_1, CType(1, Short))
		CType(Me.cmdButton, System.ComponentModel.ISupportInitialize).EndInit()
	End Sub
#End Region 
#Region "Upgrade Support "
	Private Shared m_vb6FormDefInstance As frmDeleteCategory
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As frmDeleteCategory
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New frmDeleteCategory()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			m_vb6FormDefInstance = Value
		End Set
	End Property
#End Region 
	
	Dim objCategories As Scheduler.CCategoryCol
	Public Property Categories() As Scheduler.CCategoryCol
		Get
			Categories = objCategories
		End Get
		Set(ByVal Value As Scheduler.CCategoryCol)
			
			Dim i As Short
			
			objCategories = Value
			
			For i = 1 To objCategories.Count
				lstCategory.Items.Add(objCategories.Item(i).Name)
			Next i
			
		End Set
	End Property
	Private Sub cmdButton_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdButton.Click
		Dim Index As Short = cmdButton.GetIndex(eventSender)
		
		Dim i As Short
		
		Select Case Index
			
			Case 0
				If lstCategory.SelectedItems.Count = 0 Then GoTo EndSub
				If MsgBox("Do you wish to remove the selected categories for the schedule?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Delete?") = MsgBoxResult.Yes Then
					'Loop through all the item reverse order so the index
					'will not change as we remove indexes.
					For i = lstCategory.Items.Count To 1 Step -1
						If lstCategory.GetSelected(i - 1) Then
							Categories.Remove(i) 'Remove the actual item from the collection
						End If
					Next i
				Else
					GoTo EndSub
				End If
				
			Case 1
				'Do nothing
				
		End Select
		
		Me.Close()
		
EndSub: 
		
	End Sub
	'UPGRADE_WARNING: Event frmDeleteCategory.Resize may fire when form is intialized. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup2075"'
	Private Sub frmDeleteCategory_Resize(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Resize
		
		On Error Resume Next
		
		Const cBuffer As Short = 120
		
		cmdButton(1).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(Me.ClientRectangle.Width) - VB6.PixelsToTwipsX(cmdButton(1).Width) - cBuffer), VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(Me.ClientRectangle.Height) - VB6.PixelsToTwipsY(cmdButton(1).Height) - cBuffer), 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
		cmdButton(0).SetBounds(VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(cmdButton(1).Left) - VB6.PixelsToTwipsX(cmdButton(0).Width) - cBuffer), cmdButton(1).Top, 0, 0, Windows.Forms.BoundsSpecified.X Or Windows.Forms.BoundsSpecified.Y)
		lstCategory.SetBounds(0, 0, Me.ClientRectangle.Width, VB6.TwipsToPixelsY(VB6.PixelsToTwipsY(cmdButton(1).Top) - cBuffer))
		
	End Sub
	'UPGRADE_WARNING: Form event frmDeleteCategory.Unload has a new behavior. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup2065"'
	Private Sub frmDeleteCategory_Closed(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Closed
		'UPGRADE_NOTE: Object objCategories may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1029"'
		objCategories = Nothing
		'UPGRADE_NOTE: Object frmDeleteCategory may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC/commoner/redir/redirect.htm?keyword="vbup1029"'
		frmDeleteCategory.DefInstance = Nothing
	End Sub
End Class